home *** CD-ROM | disk | FTP | other *** search
- unit Cciccinf;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, Buttons, ExtCtrls, Grids, Outline, CCWSock;
-
- type
- TCCICInfoDlg = class(TForm)
- Panel1: TPanel;
- BitBtn1: TBitBtn;
- BitBtn2: TBitBtn;
- Panel4: TPanel;
- ListBox2: TListBox;
- Panel2: TPanel;
- Edit1: TEdit;
- Panel3: TPanel;
- Edit2: TEdit;
- Panel5: TPanel;
- Edit3: TEdit;
- Panel8: TPanel;
- Edit4: TEdit;
- Panel9: TPanel;
- Edit5: TEdit;
- Panel6: TPanel;
- Label1: TLabel;
- Label2: TLabel;
- Button1: TButton;
- Button2: TButton;
- Button3: TButton;
- Button4: TButton;
- ListBox1: TListBox;
- procedure Button1Click(Sender: TObject);
- procedure ListBox2Click(Sender: TObject);
- procedure BitBtn1Click(Sender: TObject);
- procedure BitBtn2Click(Sender: TObject);
- procedure Edit4Exit(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure Button3Click(Sender: TObject);
- procedure Button4Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- CCICInfoDlg: TCCICInfoDlg;
- const
- LBClickVector : Integer = 0;
- ActiveMailbox : Integer = 0;
-
- implementation
-
- uses CCICCFrm;
-
- {$R *.DFM}
- procedure TCCICInfoDlg.Button1Click(Sender: TObject);
- var TempSocket : TCCSocket; { Used for IP Address info }
- DataBuffer : array[ 0 .. 256 ] of char;
- begin
- case Tag of
- 1 : begin { Get IP Address Mode }
- { Create the dummy socket }
- TempSocket := TCCSocket.Create( Self );
- TempSocket.Parent := Self;
- { Use it to get the info }
- with TempSocket do
- begin
- { Move the IP address into the data buffer }
- StrPCopy( DataBuffer , Edit1.Text );
- { Turn it into a real IP address in binary form }
- Socket_IP_Address.Socket_Address.Full_Internet_Address :=
- inet_addr( DataBuffer );
- { If not found then do remote lookup }
- if Socket_IP_Address.Socket_Address.Full_Internet_Address = INADDR_NONE then
- begin
- { Call blocking function on IP name }
- Socket_Host_Entry := gethostbyname( DataBuffer );
- { If still no good then error out and exit }
- if Socket_Host_Entry = nil then
- begin
- Edit2.Text := 'Could Not Convert Host Name';
- Edit3.Text := '';
- end
- else
- begin
- { Otherwise get the address }
- Socket_IP_Address.Socket_Address :=
- Socket_Host_Entry^.Host_Address^^;
- Edit2.Text :=
- IntToStr( Socket_IP_Address.Socket_Address.Net_Byte ) + '.' +
- IntToStr( Socket_IP_Address.Socket_Address.Host_Byte ) + '.' +
- IntToStr( Socket_IP_Address.Socket_Address.Local_Host_Byte ) +
- '.' + IntToStr(
- Socket_IP_Address.Socket_Address.Local_Machine_Byte );
- Edit3.Text :=
- IntToStr( Socket_IP_Address.Socket_Address.
- Full_Internet_Address );
- end;
- end;
- end;
- { Free the dummy socket }
- TempSocket.Free;
- end;
- 2 : begin { Anonymous login punch }
- Edit3.Text := 'anonymous';
- CurrentRealPWString := CurrentPassWordString;
- case PasswordControlVector of
- 1 : Edit4.Text := CurrentPassWordString;
- 2 : Edit4.Text := '**********';
- end;
- end;
- end;
- end;
-
- procedure TCCICInfoDlg.ListBox2Click(Sender: TObject);
- var TheWorkingList : TList;
- Counter_1 : Integer;
- Finished : Boolean;
- begin
- { Use Tag vector to find out how to interpret a click }
- case Tag of
- 2 : begin
- { If nothing in list box then exit }
- if ListBox2.ItemIndex = -1 then exit;
- { Use the data in the Working FTP Site List TList }
- with PConnectionsRecord(
- TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- Edit1.Text := CProfile;
- Edit2.Text := CIPAddress;
- Edit3.Text := CUserName;
- CurrentRealPWString := CPassword;
- case PasswordControlVector of
- 1 : Edit4.Text := CPassword;
- 2 : Edit4.Text := '**********';
- end;
- Edit5.Text := CStartDir;
- end;
- end;
- 4 : begin
- { If nothing in list box then exit }
- if ListBox2.ItemIndex = -1 then exit;
- { Use the data in the Working FTP Site List TList }
- with PConnectionsRecord(
- TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- Edit1.Text := CProfile;
- Edit2.Text := CIPAddress;
- end;
- end;
- end;
- end;
-
- { This procedure saves the newly modified list of stuff to its base }
- procedure TCCICInfoDlg.BitBtn1Click(Sender: TObject);
- var Counter_1 : Integer; { Loop counter }
- ThePointer : PConnectionsRecord; { Generic TCR Pointer }
- begin
- { Use the tag vector to find out what to do }
- case Tag of
- 2 : begin { Do FTP Site List }
- { dispose the old FTP site list's pointers }
- for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
- begin
- Dispose( PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] ));
- end;
- { Clear the lists }
- TheFTPSiteList.Clear;
- CCInetCCForm.ComboBox1.Clear;
- { Add the new info }
- for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
- begin
- { Create a new pointer }
- New( ThePointer );
- { Move the data into it }
- ThePointer^ :=
- PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] )^;
- { Add the item }
- TheFTPSiteList.Add( ThePointer );
- CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
- TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
- end;
- CCINetCCForm.ComboBox1.ItemIndex := 0;
- end;
- 4 : begin { Do NNTP Site List }
- { dispose the old FTP site list's pointers }
- for Counter_1 := 0 to TheNewsServerList.Count - 1 do
- begin
- Dispose( PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] ));
- end;
- { Clear the lists }
- TheNewsServerList.Clear;
- CCInetCCForm.ComboBox1.Clear;
- { Add the new info }
- for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
- begin
- { Create a new pointer }
- New( ThePointer );
- { Move the data into it }
- ThePointer^ :=
- PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] )^;
- { Add the item }
- TheNewsServerList.Add( ThePointer );
- CCINetCCForm.ComboBox1.Items.Add( PConnectionsRecord(
- TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
- end;
- CCINetCCForm.ComboBox1.ItemIndex := 0;
- end;
- end;
- { Leave }
- Close;
- end;
-
- { This method cancels any changes made from entries in current setup & exits}
- procedure TCCICInfoDlg.BitBtn2Click(Sender: TObject);
- var Counter_1 : Integer; { Loop counter }
- ThePointer : PConnectionsRecord; { Generic TCR Pointer }
- begin
- { Use Tag vector do decide what to reset }
- case Tag of
- 2 : begin { Reset FTP Site list }
- { Dispose of all the old pointers }
- for Counter_1 := 0 to TheWorkingFTPSL.Count - 1 do
- begin
- Dispose( PConnectionsRecord( TheWorkingFTPSL.Items[ Counter_1 ] ));
- end;
- { Clear the working list }
- TheWorkingFTPSL.Clear;
- { Clear the listbox }
- ListBox2.Clear;
- { Then rebuild the working list and display listbox }
- for Counter_1 := 0 to TheFTPSiteList.Count - 1 do
- begin
- { Create the record }
- New( ThePointer );
- { Move data in }
- ThePointer^ :=
- PConnectionsRecord( TheFTPSiteList.Items[ Counter_1 ] )^;
- { Add the pointer to the list }
- TheWorkingFTPSL.Add( ThePointer );
- { Add the profile name to the list }
- ListBox2.Items.Add( PConnectionsRecord(
- TheFTPSiteList.Items[ Counter_1 ] )^.CProfile );
- end;
- end;
- 4 : begin { Reset NNTP Site list }
- { Dispose of all the old pointers }
- for Counter_1 := 0 to TheWorkingNSSL.Count - 1 do
- begin
- Dispose( PConnectionsRecord( TheWorkingNSSL.Items[ Counter_1 ] ));
- end;
- { Clear the working list }
- TheWorkingNSSL.Clear;
- { Clear the listbox }
- ListBox2.Clear;
- { Then rebuild the working list and display listbox }
- for Counter_1 := 0 to TheNewsServerList.Count - 1 do
- begin
- { Create the record }
- New( ThePointer );
- { Move data in }
- ThePointer^ :=
- PConnectionsRecord( TheNewsServerList.Items[ Counter_1 ] )^;
- { Add the pointer to the list }
- TheWorkingNSSL.Add( ThePointer );
- { Add the profile name to the list }
- ListBox2.Items.Add( PConnectionsRecord(
- TheNewsServerList.Items[ Counter_1 ] )^.CProfile );
- end;
- end;
- end;
- { Leave }
- Close;
- end;
-
- procedure TCCICInfoDlg.Edit4Exit(Sender: TObject);
- begin
- { Use tag vector to determine action }
- case Tag of
- 2 : begin
- { If Edit4 is modified then mangle pw }
- if Edit4.Modified then
- begin
- { Save pw in either case, but mangle if masked }
- case PasswordControlVector of
- 1 : CurrentRealPWString := Edit4.Text;
- 2 : begin
- CurrentRealPWString := Edit4.Text;
- Edit4.Text := '***********';
- end;
- end;
- end;
- end;
- end;
- end;
-
- { Add button; do various add actions }
- procedure TCCICInfoDlg.Button2Click(Sender: TObject);
- var ThePointer : PConnectionsRecord; { PCR Pointer }
- TempList : TList;
- begin
- { Tag vector control as usual }
- case Tag of
- 2 : begin { add new FTP site list entry }
- { Creat new PCR pointer }
- New( ThePointer );
- { Add in the data from the text fields }
- with ThePointer^ do
- begin
- CProfile := Edit1.Text;
- CIPAddress := Edit2.Text;;
- CUserName := Edit3.Text;
- { Put in the real pw string }
- CPassword := CurrentRealPWString;
- CStartDir := Edit5.Text;
- end;
- { Add pointer to working list }
- TheWorkingFTPSL.Add( ThePointer );
- { Add it to the listbox }
- ListBox2.Items.Add( ThePointer^.CProfile );
- { And set the pointer to it }
- ListBox2.ItemIndex := ListBox2.Items.Count - 1;
- end;
- 4 : begin { add new NNTP site list entry }
- { Creat new PCR pointer }
- New( ThePointer );
- { Add in the data from the text fields }
- with ThePointer^ do
- begin
- CProfile := Edit1.Text;
- CIPAddress := Edit2.Text;;
- CUserName := '';
- CPassword := '';
- CStartDir := '';
- end;
- { Add pointer to working list }
- TheWorkingNSSL.Add( ThePointer );
- { Add it to the listbox }
- ListBox2.Items.Add( ThePointer^.CProfile );
- { And set the pointer to it }
- ListBox2.ItemIndex := ListBox2.Items.Count - 1;
- end;
- end;
- end;
-
- { This is the modify button }
- procedure TCCICInfoDlg.Button3Click(Sender: TObject);
- begin
- { Use Tag vector as usual }
- case Tag of
- 2 : begin
- { if nothing to modify the exit }
- if ListBox2.ItemIndex = -1 then exit;
- { get record of current listbox pointer & put in data }
- with PConnectionsRecord(
- TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- CProfile := Edit1.Text;
- CIPAddress := Edit2.Text;;
- CUserName := Edit3.Text;
- { Put in the real pw string }
- CPassword := CurrentRealPWString;
- CStartDir := Edit5.Text;
- end;
- { Make sure the display matches the edit control }
- ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
- end;
- 4 : begin
- { if nothing to modify the exit }
- if ListBox2.ItemIndex = -1 then exit;
- { get record of current listbox pointer & put in data }
- with PConnectionsRecord(
- TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- CProfile := Edit1.Text;
- CIPAddress := Edit2.Text;
- CUserName := '';
- CPassword := '';
- CStartDir := '';
- end;
- { Make sure the display matches the edit control }
- ListBox2.Items[ ListBox2.ItemIndex ] := Edit1.Text;
- end;
- end;
- end;
-
- { This is the delete button }
- procedure TCCICInfoDlg.Button4Click(Sender: TObject);
- var MessageString : String; { String holder }
- begin
- { Use tag control vector }
- case Tag of
- 2 : begin
- { If nothing to delete then leave }
- if Listbox2.Itemindex = -1 then exit;
- { Set up display }
- MessageString := 'Delete Entry ' + Edit1.Text + '?';
- { Display message box and get result }
- if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
- = mrYes then
- begin
- { if ok delete then remove item from working sl }
- TheWorkingFTPSL.Delete( ListBox2.ItemIndex );
- { delete from listbox }
- ListBox2.Items.Delete( ListBox2.ItemIndex );
- { If nothing left set itemindex and clear edits }
- if ListBox2.Items.Count = 0 then
- begin
- ListBox2.ItemIndex := -1;
- Edit1.Text := '';
- Edit2.Text := '';
- Edit3.Text := '';
- Edit4.Text := '';
- Edit5.Text := '';
- end
- else
- begin
- { Reset listbox pointer }
- ListBox2.ItemIndex := 0;
- { and reset display to new item }
- with PConnectionsRecord(
- TheWorkingFTPSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- Edit1.Text := CProfile;
- Edit2.Text := CIPAddress;
- Edit3.Text := CUserName;
- CurrentRealPWString := CPassword;
- case PasswordControlVector of
- 1 : Edit4.Text := CPassword;
- 2 : Edit4.Text := '**********';
- end;
- Edit5.Text := CStartDir;
- end;
- end;
- end;
- end;
- 4 : begin
- { If nothing to delete then leave }
- if Listbox2.Itemindex = -1 then exit;
- { Set up display }
- MessageString := 'Delete Entry ' + Edit1.Text + '?';
- { Display message box and get result }
- if MessageDlg( MessageString , mtConfirmation , mbYesNoCancel , 0 )
- = mrYes then
- begin
- { if ok delete then remove item from working sl }
- TheWorkingNSSL.Delete( ListBox2.ItemIndex );
- { delete from listbox }
- ListBox2.Items.Delete( ListBox2.ItemIndex );
- { If nothing left set itemindex and clear edits }
- if ListBox2.Items.Count = 0 then
- begin
- ListBox2.ItemIndex := -1;
- Edit1.Text := '';
- Edit2.Text := '';
- Edit3.Text := '';
- Edit4.Text := '';
- Edit5.Text := '';
- end
- else
- begin
- { Reset listbox pointer }
- ListBox2.ItemIndex := 0;
- { and reset display to new item }
- with PConnectionsRecord(
- TheWorkingNSSL.Items[ ListBox2.ItemIndex ] )^ do
- begin
- Edit1.Text := CProfile;
- Edit2.Text := CIPAddress;
- end;
- end;
- end;
- end;
- end;
- end;
-
- end.
-